/*******************************************************************************
* Copyright (C) 2019 China Micro Semiconductor Limited Company. All Rights Reserved.
*
* This software is owned and published by:
* CMS LLC, No 2609-10, Taurus Plaza, TaoyuanRoad, NanshanDistrict, Shenzhen, China.
*
* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
*
* This software contains source code for use with CMS
* components. This software is licensed by CMS to be adapted only
* for use in systems utilizing mixic components. CMS shall not be
* responsible for misuse or illegal use of this software for devices not
* supported herein. CMS is providing this software "AS IS" and will
* not be responsible for issues arising from incorrect user implementation
* of the software.
*
* This software may be replicated in part or whole for the licensed use,
* with the restriction that this Disclaimer and Copyright notice must be
* included with each copy of this software, whether used in part or whole,
* at all times.
*****************************************************************************/

/****************************************************************************/
/** \file main.c
**
**	History:	wenguoliang
**	
*****************************************************************************/
/****************************************************************************/
/*	include files
*****************************************************************************/
#include "mcu_driver.h"
#include "motor_driver.h"
#include "include.h"

/****************************************************************************/
/*	Local pre-processor symbols/macros('#define')
*****************************************************************************/


/****************************************************************************/
/*	Global variable definitions(declared in header file with 'extern')
*****************************************************************************/

/****************************************************************************/
/*	Local type definitions('typedef')
*****************************************************************************/

/****************************************************************************/
/*	Local variable  definitions('static')
*****************************************************************************/


/****************************************************************************/
/*	Local function prototypes('static')
*****************************************************************************/


/****************************************************************************/
/*	Function implementation - global ('extern') and local('static')
*****************************************************************************/


/*****************************************************************************
 ** \brief	 main
 **
 ** \param [in]  none   
 **
 ** \return 0
*****************************************************************************/
int main(void)
{	
	/*System Initialization*/
	System_Init();
	
	/*Watch dog Initialization*/
	WDT_Init();	
	
	/*Enable interrupt*/
	__EI();
  SYS_SET_IOCFG(IOP10CFG, SYS_IOCFG_P10_GPIO);
	GPIO_CONFIG_IO_MODE(GPIO1,GPIO_PIN_0,GPIO_MODE_OUTPUT);
	while(1)
	{		
		/*Clear watch dog*/
		WDT_ClearWDT();	
		
		if( TimeFlag_1ms )
			SysTick_1ms();
		
		/*Motor Control*/
		MC_Control();	
	}	
}

